<%-- 
    Document   : suacathi
    Created on : Sep 19, 2012, 12:03:04 PM
    Author     : Odotube
--%>

<%@page import="thitracnghiem.GiaoVien"%>
<%@page import="thitracnghiem.Lop"%>
<%@page import="java.util.ArrayList"%>
<%@page import="thitracnghiem.MonThi"%>
<%@page import="thitracnghiem.CaThi"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%

            session = request.getSession();

            CaThi ct = (CaThi) session.getAttribute("cathicansua");
            GiaoVien gv = (GiaoVien) session.getAttribute("gv");
             if (gv == null || ct==null) {
             response.sendError(403);
             return;
                
             }
        %>
        <form action="/ThiTracNghiem/XuLy" method="post">
            <%
                String s = "";
                s = request.getParameter("tb");
                if (s == null) {
                    s = "";
                }
                MonThi.Open();
                ArrayList<MonThi> dsMonThi = MonThi.getDSMonThi();
                MonThi.Close();
                s += "Mon thi: <select name='mamonthi'>";
                for (int i = 0; i < dsMonThi.size(); i++) {
                    //if (!dsMonThi.get(i).getMaMonThi().equals(ct.getMaMonThi())) {
                        s += "<option value='" + dsMonThi.get(i).getMaMonThi() + "'>" + dsMonThi.get(i).getTenMonThi();
                    //} else {
                      //  s += "<option value='" + dsMonThi.get(i).getMaMonThi() + "' selected>" + dsMonThi.get(i).getTenMonThi();
                    //}
                }
                s += "</select><br>";
                Lop.Open();
                ArrayList<String> dsLop = Lop.getDSCacLop();
                Lop.Close();
                s += "Lop: <select name=lop>";
                for (int i = 0; i < dsLop.size(); i++) {
                    //if (dsLop.get(i).equals(ct.getLop())) {
                        s += "<option value='" + dsLop.get(i) + "'>" + dsLop.get(i);
                   // } else {
                    //    s += "<option value='" + dsLop.get(i) + "' selected>" + dsLop.get(i);
                   // }
                }
                s += "</select><br> Lan thi: <input type='text' name='lanthi' value='"+ct.getLanThi()+"'><br>";
                out.println(s);
            %>
            Ngay thi: <input type="text" name="ngaythi" value="<%=ct.getNgayThi()%>"><br>
            Thoi gian bat dau:  <input type="text" name="tgbatdau" value="<%=ct.getTGBatDau()%>"><br>
            Thoi gian ket thuc: <input type="text" name="tgketthuc" value="<%=ct.getTGKetThuc()%>"><br>
            So cau hoi: <input type="text" name="socauhoi" value="<%=ct.getSoCauHoi()%>"><br>
            <input type="hidden" name="yc" value="quanlycathi">
            <input type="submit" name="hoantatsuacathi" value="Sua">
            <input type="submit" name="hoantatsuacathi" value="Khong">
            
        </form>
    </body>
</html>
